package com.cd.hospital.www.config;

import com.cybermkd.mongo.kit.MongoKit;
import com.cybermkd.mongo.plugin.MongoPlugin;
import com.mongodb.MongoClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.web.support.SpringBootServletInitializer;

/**
 * Created by weirdor on 2017/9/18.
 */
public class WebMvcStrap extends SpringBootServletInitializer implements CommandLineRunner {

    protected final static Logger LOG = LoggerFactory.getLogger(WebMvcStrap.class);

    private void mongoInit() {
        LOG.info("--mongo start--");
        System.out.println("-------mongo start--------");
        MongoPlugin mongoPlugin=new MongoPlugin();
        mongoPlugin.add("112.74.83.134");
        mongoPlugin.setDatabase("cdhospital");
        MongoClient client = mongoPlugin.getMongoClient();
        MongoKit.INSTANCE.init(client, mongoPlugin.getDatabase());
        LOG.info("--mongo end--");
    }

    @Override
    public void run(String... strings) throws Exception {
       // mongoInit();
    }
}
